<?
require("config.php");

$location_status .= "| Add";
$menuname = NULL;
$menutarget = NULL;

if (NULL!=$action){

	$Date = "$Year-$Month-$Day";

   $field = array(
	"code", 
	"subject", 
	"mydate",
	"details",
    "status",
	"publish_date",
	"picture","order_index",
	);

   $content = array(
	$Code,
	$Subject,
	$myDate,
	$Details,
	$Status,
	"$myYear-$myMonth-$myDay",
	$Picture_name, $order_index,
	);

   myInsert($table,$field,$content);

	$dir = "$table/";

	myUpload($Picture,$Picture_name,$dir);

   header("location:" . $rela_path . "share/msg.php?v=311");

   exit();

}else{

  if (checkCode($table,$Code)){

	header("location:" . $rela_path . "share/msg.php?v=9001");

	exit();
  
  }

}

require($rela_path . "inc/header.php");
require($rela_path . "bin/date.php");


?>



<form action="" method="post" enctype="multipart/form-data" name="form1">
<input name="action" type="hidden" value="add">
<input name="Code" type="hidden" value="<?print($Code)?>">




<table width="95%" border="0" align="center">
  <tr> 
    <td valign="top"> <table border="0" cellspacing="5" cellpadding="1">
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td class="tdheader">Code : </td>
            <td><?print($Code)?></td>
          </tr>
          <tr> 
            <td class="tdheader">Subject :</td>
            <td><input type="text" class="text" name="Subject" size="56"></td>
          </tr>


          <tr> 
            <td class="tdheader">Date :</td>
            <td><input type="text" class="text" name="MyDate" size="56"></td>
          </tr>



          <tr> 
            <td class="tdheader">Publish :</td>
            <td> 
          <?

$sourceData = array(
  "Yes",
  "No",
  );

$boxName="Status";

$value=$Status;

FFPCheckBox("Status",$Status,$sourceData,$sourceLabel);

?>          </tr>
          <tr> 
            <td class="tdheader">Publishing Date : </td>
            <td><?print(FFPtime(date("Y-m-d H:i")))?></td>
          </tr>
          <tr> 
            <td class="tdheader">Details : </td>
            <td><textarea class="text" name="Details" cols="55" rows="20"></textarea></td>
          </tr>
          <tr>
            <td class="tdheader">Order :</td>
            <td><input name="order_index" type="text" class="text" id="order_index" size="5" /></td>
          </tr>
          <tr>
            <td>Picture :</td>
            <td><input type="file" class="text" name="Picture" size="45"></td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td><input type="image" src="../../images/bt_cancel.gif" onClick="Redirect('menu.php',1);return false;"> 
              <input type="image" src="../../images/bt_save.gif"> </td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
    </td>

  </tr>
</table>
<br>
<br>
<br>


</form>

<?
require($rela_path . "inc/footer.php");
?>
